﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace WorkerHourManager.Account
{
    public partial class Login : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            RegisterHyperLink.NavigateUrl = "Register.aspx";
            OpenAuthLogin.ReturnUrl = Request.QueryString["ReturnUrl"];

            var returnUrl = HttpUtility.UrlEncode(Request.QueryString["ReturnUrl"]);
            if (!String.IsNullOrEmpty(returnUrl))
            {
                RegisterHyperLink.NavigateUrl += "?ReturnUrl=" + returnUrl;
            }

            
            
        }

        protected void Unnamed6_Click(object sender, EventArgs e)
        {
            TextBox uName = (TextBox)Login1.FindControl("UserName");
            TextBox pwd = (TextBox)Login1.FindControl("Password");
            
            DAL query = new DAL();
            
            query.init();

            //if admin re-dir to admin
            if (query.getEmployeeById(uName.Text).isBoss)
            {
                Response.Redirect("http://www.microsoft.com/gohere/look.htm");
            }
            //if mana redir to mana
            //if emp redir to emp
            
        }
    }
}